function checkWriteForm(form) {
	
	if(form.user_name.value == '') {
		alert('작성자를 입력해 주세요');
		form.user_name.focus();
		return false;
	}
	if(form.subjects.value == '') {
		alert('제목을 입력해 주세요');
		form.subjects.focus();
		return false;
	}
	if(form.contents.value == '') {
		alert('내용을 입력해 주세요');
		form.contents.focus();
		return false;
	}
	if(form.user_passwd && form.user_passwd.value == '') {
		alert('비밀번호를 입력해 주세요');
		form.user_passwd.focus();
		return false;
	}

	return true;

}


function checkModifyConfirmForm(form) {
	if(form.user_passwd.value == '') {
		alert('비밀번호를 입력해 주세요');
		form.user_passwd.focus();
		return false;
	}

	return true;

}

function checkModifyForm(form) {
	
	if(form.user_name.value == '') {
		alert('작성자를 입력해 주세요');
		form.user_name.focus();
		return false;
	}
	if(form.subjects.value == '') {
		alert('제목을 입력해 주세요');
		form.subjects.focus();
		return false;
	}
	if(form.contents.value == '') {
		alert('내용을 입력해 주세요');
		form.contents.focus();
		return false;
	}

	if(form.user_passwd && form.user_passwd.value == '') {
		alert('비밀번호를 입력해 주세요');
		form.user_passwd.focus();
		return false;
	}

	return true;

}


function checkViewConfirmForm(form) {
	if(form.user_passwd.value == '') {
		alert('비밀번호를 입력해 주세요');
		form.user_passwd.focus();
		return false;
	}

	return true;

}

function checkWriteCommentsForm(form) {

	if(form.user_name.value == '') {
		alert("작성자 이름을 입력해주세요");
		form.user_name.focus();
		return false;
	}
	if(form.contents.value == '') {
		alert("내용을 입력해주세요");
		form.contents.focus();
		return false;
	}

	return true;

}

function checkLoginForm(form) {

	if(form.admin_id.value == '') {
		alert("아이디를 입력해주세요");
		form.admin_id.focus();
		return false;
	}
	if(form.admin_pw.value == '') {
		alert("비밀번호를 입력해주세요");
		form.admin_pw.focus();
		return false;
	}
	return true;

}

function deleteCommentConfirm(category,bbs_no,page,comm_no) {

	if(confirm("정말 해당 답변글을 삭제하시겠습니까?")) {
		document.location.href = "/Customer/executeDeleteComments/"+category+"/"+bbs_no+"/"+page+"/"+comm_no;
	} else {
		return;
	}

}



function viewPasswordForm(obj) {

	var pw_obj = document.getElementById('passwd_area');

	if(obj.checked == true) {
		pw_obj.style.display = "block";
	} else {
		pw_obj.style.display = "none";
	}

	document.admin_form.new_admin_pw.focus();


}


function checkAdminForm(form) {

	if(form.admin_name.value == '') {
		alert("이름을 입력해주세요");
		form.admin_name.focus();
		return false;
	}
	if(form.admin_email.value == '') {
		alert("이메일을 입력해주세요");
		form.admin_email.focus();
		return false;
	}


	if(form.mod_admin_pw.checked == true) {

		if(form.admin_pw.value == '') {
			alert("기존 비밀번호를 입력해주세요");
			form.admin_pw.focus();
			return false;
		}

		if(form.new_admin_pw.value == '') {
			alert("새 비밀번호를 입력해주세요");
			form.new_admin_pw.focus();
			return false;
		}

		if(form.new_admin_pw2.value == '') {
			alert("새 비밀번호를 동일하게 한번 더 입력해주세요");
			form.new_admin_pw2.focus();
			return false;
		}
		
		if(form.new_admin_pw.value != form.new_admin_pw2.value) {
			alert("두번입력하신 새비밀번호가 일치하지 않습니다.");
			form.new_admin_pw2.focus();
			form.new_admin_pw2.select();
			return false;
		}

	}

	if(form.admin_pw.value == '') {
		alert("비밀번호를 입력해주세요");
		form.admin_pw.focus();
		return false;
	}


	return true;


}





function deleteBBS(category,bbs_no,page) {

	if(confirm("정말 해당글을 삭제하시겠습니까?")) {
		document.location.href = "/Customer/viewDeleteConfirm/"+category+"/"+bbs_no+"/"+page;
	} else {
		return;
	}
	

}